//
//  OPQCuideCollectionController.m
//  NewWorld
//
//  Created by 秦川 on 16/4/27.
//  Copyright © 2016年 itcast. All rights reserved.
//

#import "OPQCuideCollectionController.h"
#import "OPQCGuideCell.h"
#define kScreenBounds  [UIScreen mainScreen].bounds
#define kScreenWidth   [UIScreen mainScreen].bounds.size.width
#define kScreenHeight   [UIScreen mainScreen].bounds.size.height
@interface OPQCuideCollectionController ()

@end
@implementation OPQCuideCollectionController

static NSString * const reuseIdentifier = @"Cell";

- (instancetype)init
{
    UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init];
    
    //设置itm的大小
    flowLayout.itemSize = kScreenBounds.size;
    
    flowLayout.minimumLineSpacing = 0;
    
    //设置横向滚动
    flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    
    return [super initWithCollectionViewLayout:flowLayout];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //弹动禁止
    self.collectionView.bounces = NO;
    
    //分页
    self.collectionView.pagingEnabled = YES;
    
    //取消横向的滚动条
    self.collectionView.showsHorizontalScrollIndicator = NO;
    [self.collectionView registerClass:[OPQCGuideCell class] forCellWithReuseIdentifier:reuseIdentifier];
}

#pragma mark <UICollectionViewDataSource>

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
    
    return 1;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    
    return 3;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    
    OPQCGuideCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath];
    
    NSString *imageName = [NSString stringWithFormat:@"0%@引导页%@_640x960",@(indexPath.row +2),@(indexPath.row + 1)];
    
    
    cell.guideImage = [UIImage imageNamed:imageName];
    
    [cell scrowWithIndexpath:indexPath withCount:3];
    return  cell;
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}




@end
